/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */
package cn.webrx.exam;

import java.io.IOException;
import java.util.Scanner;

/**
 * <p>Project: javaseapp - Ex2
 * <p>Powered by webrx On 2021-08-07 11:32:40
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 16
 */
public class Ex6 {
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入姓名：");
        String name = sc.nextLine();
        String p = "([a-zA-Z ]+|[\u4e00-\u9fa5 ]+)";
        if (name.matches(p)) {
            System.out.printf("注册成功，欢迎：%s。%n", name);
        } else {
            System.err.printf("注册失败，姓名必须全中文 或 全英文，不能是中央混合。%n");
        }
    }
}
